from threading import Thread

class MyThread(Thread):
    def __init__(self,a,b):
        self.a=a
        self.b=b
        super().__init__()
    def run(self):
        print(self.ident)


t=MyThread(1,2)
t.start()#开启线程，然后才在执行run方法
# t.run()
print(t.ident)


#线程之间数据共享
from threading import Thread
n=100

def func():
    global n
    n-=1
t_1=[]
for i in range(100):
    t=Thread(target=func)
    t.start()
    t_1.append(t)
for t in t_1:
    t.join()
print(n)











